#%RAML 1.0
title: Holdings Storage
version: v4.2
protocols: [ HTTP, HTTPS ]
baseUri: http://localhost

documentation:
  - title: Holdings Records Storage API
    content: <b>Storage for holdings in the inventory</b>

types:
  holdingsRecord: !include holdingsrecord.json
  holdingsRecords: !include holdingsrecords.json
  errors: !include raml-util/schemas/errors.schema

traits:
  language: !include raml-util/traits/language.raml
  pageable: !include raml-util/traits/pageable.raml
  searchable: !include raml-util/traits/searchable.raml
  validate: !include raml-util/traits/validation.raml

resourceTypes:
  collection: !include raml-util/rtypes/collection.raml
  collection-item: !include raml-util/rtypes/item-collection.raml

/holdings-storage:
  /holdings:
    displayName: Holdings
    type:
      collection:
        exampleCollection: !include  examples/holdingsrecords_get.json
        schemaCollection: holdingsRecords
        schemaItem: holdingsRecord
        exampleItem: !include  examples/holdingsrecord_get.json
    get:
      is: [pageable,
           searchable: {description: "by instance ID (using CQL)",
                        example: "instanceId=\"2b94c631-fca9-4892-a730-03ee529ffe2a\""},
          ]
    post:
      is: [validate]
    delete:
      is: [language]
      responses:
        204:
          description: "All holdings deleted"
        500:
          description: "Internal server error, e.g. due to misconfiguration"
          body:
            text/plain:
              example: "Internal server error, contact administrator"
    /{holdingsRecordId}:
      type:
        collection-item:
          exampleItem: !include examples/holdingsrecord_get.json
          schema: holdingsRecord
      get:
        responses:
          200:
            body:
#              type: holdinsgrecord
            description: |
              Get Holdings Record by holdingsRecordId
